<div class="dashboard-block main-inner3">
<?php echo $this->element('users_edit-profile_link', array('config' => 'sec')); ?>

<h3><?php echo sprintf(__l('Allow %s to share your projects'),Configure::read('site.name')); ?></h3>

<?php echo $this->Form->create('User', array('action' => 'update', 'class' => 'normal js-upadte-setting-form'));
      
	  echo $this->Form->input('UserPermissionPreference.id', array('type' => 'hidden'));
?>

<?php if(empty($this->request->data['User']['fb_access_token'])): ?>
<div class="dashboard-inner-block round-5">
<h4><?php echo __l('Connect to Facebook'); ?></h4>
<p>
  <?php echo __l('Connect your Facebook account to automatically push status updates about your project in your news stream.');?>
</p>
<div class="connect-link-block clearfix">
  <?php echo $this->Html->link(__l('Connect'), $fb_login_url); ?>
	</div>
</div>
<?php else: ?>
    <div class="dashboard-inner-block round-5">
        <h4><?php echo __l('Update my Facebook status when'); ?></h4>
            <?php
            echo $this->Form->input('UserPermissionPreference.fb_status_new_project', array('class' =>'js-update-user-settings', 'type' => 'checkbox', 'label' => __l('I have placed a new project.') ) );
            echo $this->Form->input('UserPermissionPreference.fb_status_project_pledged', array('class' =>'js-update-user-settings', 'type' => 'checkbox', 'label' => __l('Pledged for a project.')));
            ?>
            <div class="connect-link-block clearfix">
            <?php
            	   echo $this->Html->link(__l('Disconnect'), array('controller' => 'users', 'action' => 'connect', $this->request->data['User']['id'], 'type' => 'facebook', 'c_action' =>'disconnect'), array('escape' => false, 'class' => 'js-delete'));
        	?>
        	</div>
    </div>
<?php endif; ?>
<?php if(empty($this->request->data['User']['twitter_access_token'])): ?>
    <div class="dashboard-inner-block round-5">
        <h4><?php echo __l('Connect to Twitter'); ?></h4>
        <p>
          <?php echo __l('Connect your Twitter account to automatically push status updates about your project to your followers.');?>
        </p>
        <div class="connect-link-block clearfix">
          <?php
        	   echo $this->Html->link(__l('Connect'), array('controller' => 'users', 'action' => 'connect', $this->request->data['User']['id'], 'type' => 'twitter'), array('escape' => false));
        	?>
        </div>
    </div>
<?php else: ?>
    <div class="dashboard-inner-block round-5">
        <h4><?php echo __l('Tweet when'); ?></h4>
            <?php

            echo $this->Form->input('UserPermissionPreference.twitter_status_new_project', array('class' =>'js-update-user-settings', 'type' => 'checkbox', 'label' => __l('I have placed a new project.')) );
            echo $this->Form->input('UserPermissionPreference.twitter_status_project_pledged', array('class' =>'js-update-user-settings', 'type' => 'checkbox', 'label' => __l('Pledged for a project')));
            ?>
            <div class="connect-link-block clearfix">
            <?php
            	   echo $this->Html->link(__l('Disconnect'), array('controller' => 'users', 'action' => 'connect', $this->request->data['User']['id'], 'type' => 'twitter', 'c_action' =>'disconnect'), array('escape' => false, 'class' => 'js-delete'));
        	?>
        	</div>
    	</div>
<?php endif; ?>
<?php echo $this->Form->end();?>
</div>